Expand description
A rust library for the Zarr V3 storage format for multidimensional arrays and metadata.
Developed at the Department of Materials Physics, Australian National University, Canberra, Australia.
zarrs is experimental and in limited production use. Use at your own risk! Correctness issues with past versions are detailed here.
A changelog can be found here.
§Getting Started
- View the examples.
- Read the documentation.
array::Array
andstorage
are good places to start. - Check out zarrs_tools for real-world usage and performance benchmarks of
zarrs
.
§Example
let store_path: PathBuf = "/path/to/store".into();
let store: zarrs::storage::ReadableWritableListableStorage =
Arc::new(zarrs::storage::store::FilesystemStore::new(&store_path)?);
let array_path: &str = "/group/array"; // /path/to/store/group/array
let array = zarrs::array::Array::new(store, array_path)?;
let chunk: ndarray::ArrayD<f32> = array.retrieve_chunk_ndarray(&[1, 0])?;
println!("Chunk [1,0] is:\n{chunk}");
§Implementation Status
Zarr Enhancement Proposals (ZEPs)
Zarr Enhancement Proposal | Status | Zarrs | Feature Flags* |
---|---|---|---|
ZEP0001 - Zarr specification version 3 | Accepted | Full support | |
ZEP0002 - Sharding codec | Accepted | Full support | sharding, crc32c |
ZEP0003 - Variable chunking | Draft | Full support |
* Bolded feature flags are part of the default set of features.
Stores and Storage Adapters
Store/Storage Adapter | ZEP | Read | Write | List | Sync | Async | Feature Flag |
---|---|---|---|---|---|---|---|
FilesystemStore | ZEP0001 | ✓ | ✓ | ✓ | ✓ | ||
MemoryStore | ✓ | ✓ | ✓ | ✓ | |||
HTTPStore | ✓ | ✓ | http | ||||
OpendalStore | ✓* | ✓* | ✓* | ✓ | opendal | ||
AsyncOpendalStore | ✓* | ✓* | ✓* | ✓ | opendal | ||
AsyncObjectStore | ✓* | ✓* | ✓* | ✓ | object_store | ||
ZipStorageAdapter | ✓ | ✓ | ✓ | zip |
* Support depends on the opendal::BlockingOperator
/Operator
or object_store
store.
Data Types
Codecs
Codec Type | Codec | ZEP | Zarrs | Feature Flag* |
---|---|---|---|---|
Array to Array | transpose | ZEP0001 | Full support | transpose |
bitround | Experimental | bitround | ||
Array to Bytes | bytes | ZEP0001 | Full support | |
sharding_indexed | ZEP0002 | Full support | sharding | |
zfp | Experimental | zfp | ||
pcodec | Experimental | pcodec | ||
Bytes to Bytes | blosc | ZEP0001 | Full support | blosc |
gzip | ZEP0001 | Full support | gzip | |
crc32c | ZEP0002 | Full support | crc32c | |
zstd | GitHub PR | Full support | zstd | |
bz2 | Experimental | bz2 |
* Bolded feature flags are part of the default set of features.
- They will not be supported by other Zarr V3 implementations until they have been standardised.
- The
"name"
of of experimental codecs in array metadata is a link to either:- a Zarr ZEP draft or GitHub PR, or
- the codec documentation in this crate.
Chunk Grids
Chunk Grid | ZEP | Zarrs | Feature Flag |
---|---|---|---|
regular | ZEP0001 | Full support | |
rectangular | ZEP0003 | Full support |
Chunk Key Encodings
Storage Transformers
Storage Transformer | ZEP | Zarrs | Feature Flag |
---|---|---|---|
usage log | Full support | ||
performance metrics | Full support |
§Crate Features
§Default
ndarray
:ndarray
utility functions forArray
.- Codecs:
blosc
,gzip
,transpose
,zstd
,sharding
,crc32c
.
§Non-Default
async
: an experimental asynchronous API forstores
,Array
, andGroup
.- The async API is runtime-agnostic. This has some limitations that are detailed in the
Array
docs. - The async API is not as performant as the sync API.
- The async API is runtime-agnostic. This has some limitations that are detailed in the
- Codecs:
bitround
,bz2
,pcodec
,zfp
,zstd
. - Stores:
http
,object_store
,opendal
,zip
.
§Examples
Examples can be run with cargo run --example <EXAMPLE_NAME>
.
Add -- --usage-log
to see storage API calls during example execution.
Some examples require non-default features, which can be enabled with --features <FEATURES>
.
§Sync API
array_write_read
,
array_write_read_ndarray
,
sharded_array_write_read
,
rectangular_array_write_read
,
zip_array_write_read
,
http_array_read
.
§Async API
async_array_write_read
,
async_http_array_read
.
§zarrs
Ecosystem
- zarrs_tools: Various tools for creating and manipulating Zarr v3 data. Includes
zarrs
benchmarks. - zarrs_ffi: A subset of zarrs exposed as a C API.
§Licence
zarrs
is licensed under either of
- the Apache License, Version 2.0 LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0 or
- the MIT license LICENSE-MIT or http://opensource.org/licenses/MIT, at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Re-exports§
pub use bytemuck;
pub use bytes;
pub use dyn_clone;
pub use half;
pub use serde_json;
pub use ndarray;
ndarray
pub use object_store;
object_store
pub use opendal;
opendal
Modules§
- Zarr arrays.
- Array subsets.
- Byte ranges.
- Zarrs global configuration options.
- Zarr groups.
- Zarr metadata utilities.
- Zarr nodes.
- Zarr extension points utilities.
- Zarr storage (stores and storage transformers).
- Zarrs version information.